#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int tail=-1;
		int head=0;
		int n;
		cin>>n;
		int f=0;
          		for(int i=1;i<=n;i++)
		{
			int num;
			cin>>num;
			if(i==1) 
			{
				head=num;
				cout<<1;
			}
			else if(!f)
			{
				if(tail==-1)
				{
					if(num>=head)
					{
						cout<<1;
						tail=num;
					}
					else
					{
						cout<<1;
						tail=num;
						f=1;
					}
				}
				else if(num>=tail && tail!=-1)
				{
					tail=num;
					cout<<1;
				}
				else if(num<tail && num<=head)
				{
					f=1;
					tail=num;
					cout<<1;
				}
				else if(num<tail && num>head)
				{
					cout<<0;
				}
			}
			else
			{
				if(num>=tail && num<=head)
				{
					cout<<1;
					tail=num;
				}
				else cout<<0;
			}
			
		}
		cout<<endl;
	}

	return 0;
}

